import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-07-17
 * Time: 20:47
 */
public class Test59 {
    static List<List<Integer>> ret;
    static List<Integer> path;
    static int sum;
    public static List<List<Integer>> combinationSum(int[] candidates, int target) {
        ret = new ArrayList<>();
        path = new ArrayList<>();
        sum = target;
        dfs(candidates,0,0);
        return ret;
    }

    static void dfs(int[] candidates,int pos,int target) {
        if(sum == target) {
            ret.add(new ArrayList<>(path));
            return;
        }
        // 剪枝
        if(sum < target || pos > candidates.length) {
            return;
        }
        for(int i = pos; i < candidates.length;i++) {
            path.add(candidates[i]);
            dfs(candidates,i,target+candidates[i]);
            path.remove(path.size()-1);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[n];
        for(int i = 0; i < n; i++) {
            num[i]=sc.nextInt();
        }
        int target = sc.nextInt();
        List<List<Integer>> res = combinationSum(num,target);
        System.out.println(res);
    }

}
